package com.homegoods.orderinfodetail.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.alibaba.fastjson.annotation.JSONField;
import com.homegoods.orderinfodetail.item.GoodsParamItem;
import com.kedll.library.adapter.MultiTypeAdapter;
import com.kedll.library.mvp.BaseModel;

/**
 * @author QiQi
 * @ClassName: GoodsParamModel
 * @date 2018/9/22
 * @description
 */
public class GoodsParamModel extends BaseModel<GoodsParamItem> implements Parcelable {
    @JSONField(alternateNames = {"title"})
    private String name;

    private String intro;

    public String getName() {
        return name == null ? "" : name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIntro() {
        return intro == null ? "" : intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    @Override
    public GoodsParamItem createItem(MultiTypeAdapter adapter) {
        return new GoodsParamItem(this);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.name);
        dest.writeString(this.intro);
    }

    public GoodsParamModel() {
    }

    protected GoodsParamModel(Parcel in) {
        this.name = in.readString();
        this.intro = in.readString();
    }

    public static final Parcelable.Creator<GoodsParamModel> CREATOR = new Parcelable.Creator<GoodsParamModel>() {
        @Override
        public GoodsParamModel createFromParcel(Parcel source) {
            return new GoodsParamModel(source);
        }

        @Override
        public GoodsParamModel[] newArray(int size) {
            return new GoodsParamModel[size];
        }
    };
}
